package com.hjw.java.abstract_demo1;

/**
 * @author hjwStrart
 * @create 2022-01-13 10:54
 */
public abstract class Card {

    private String noCard;   //卡号
    private String password;   //密码
    private String user;   //客户姓名
    private Double balance;   //余额
    private Double discount;  // 表示折扣

    public Card() {
    }

    public Card(String noCard, String password, String user, Double balance) {
        this.noCard = noCard;
        this.password = password;
        this.user = user;
        this.balance = balance;
    }

    public Double getDiscount() {
        return discount;
    }

    public void setDiscount(Double discount) {
        this.discount = discount;
    }

    public String getNoCard() {
        return noCard;
    }

    public void setNoCard(String noCard) {
        this.noCard = noCard;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getUser() {
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }

    public Double getBalance() {
        return balance;
    }

    public void setBalance(Double balance) {
        this.balance = balance;
    }

    //支付功能
    public abstract Boolean pay(Double paymentAmount);
//    充钱
    public void  topUp(Double money){

        if (money == null || money < 0){
            return;
        }
        balance += money;

    }
}
